<script setup lang='ts'>
import { usePreInsuranceRiskControl } from "./hooks/PreInsuranceRiskControl";
import { PureTableBar } from "@/components/RePureTableBar";
const { columns,
  dataList,
  loading,
  modelList,
  pagination,
  btnloading,
  selectmodel,
  DialogVisible,
  close_from,
  oneclickinsurance,
  handleSizeChange,
  handleCurrentChange,
  handleSelectionChange
} = usePreInsuranceRiskControl();
</script>

<template>
  <div class="main">
    <!-- 投保前风控 -->
    <PureTableBar title="投前风控" class="list_hei">
      <template #buttons>
        <el-button type="primary" @click="DialogVisible = true">一键核保</el-button>
      </template>
      <template v-slot="{ size, checkList }">
        <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" adaptive :loading="loading"
          size="small" :data="dataList" max-height="650" :columns="columns" :checkList="checkList"
          @size-change="handleSizeChange" @current-change="handleCurrentChange" @selection-change="handleSelectionChange"
          :pagination="pagination" :header-cell-style="{
            background: 'var(--el-table-row-hover-bg-color)',
            color: 'var(--el-text-color-primary)'
          }">
        </pure-table>
      </template>
    </PureTableBar>

    <ReDialog :width="350" :height="150" :models="DialogVisible" @Closes="close_from()">
      <template #header>
        <h2 style="text-align: center;">一键核保</h2>
      </template>
      <template #main>
        <div class="h-full flex items-center justify-center">
          <el-form-item label="风控模型" label-width="90">
            <el-select v-model="selectmodel" value-key="id">
              <el-option v-for="item in modelList" :key="item.id" :label="item.name" :value="item" />
            </el-select>
          </el-form-item>
        </div>

      </template>
      <template #footer>
        <el-button type="primary" @click="oneclickinsurance()" :loading="btnloading">确定 </el-button>
        <el-button @click="close_from()"> 取消 </el-button>
      </template>
    </ReDialog>
  </div>
</template>

<style scoped lang="scss">
@import url(@/style/CreditComm.scss);

:deep(.el-dialog) {
  border-radius: 10px;
}

:deep(.el-dialog__footer) {
  text-align: center;
}
</style>
